const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: 'development', entry: ['./src/index.js',], output: {
    clean: true, filename: 'bundle.js', // output 的输出路径要求必须是绝对路径
    path: path.resolve(__dirname, 'dist'),
  }, module: {
    rules: [{
      test: /\.vue$/i, use: [{loader: 'vue-loader'},],
    }, {
      test: /\.js$/i, use: [{loader: 'babel-loader'},],
    }, {
      test: /\.css$/i, use: ['style-loader', 'css-loader'],
    }, {
      test: /\.scss$/i, use: ['style-loader', 'css-loader', 'sass-loader'],
    }, {
      test: /\.(png|svg|jpg|jpeg|gif|webp)$/i, type: 'asset/resource',
    }, {
      test: /\.(ttf|png|jpg)$/i, use: {loader: 'file-loader'},
    },],
  }, plugins: [new HtmlWebpackPlugin({
    template: './index.html'
  })]
}
